import request from '@/utils/request'

/**
 * 获取班级列表
 * @param {Object} data: { page: 页码, pagesize: 每页条数 }
 * @return Promise
 */
export const getClassListAPI = (params) => {
  return request({
    url: '/class/',
    params
  })
}

/**
 * 根据name模糊查询班级
 * @param {Object} data: { page: 页码, pagesize: 每页条数, name:类型名称 }
 * @return Promise
 */
export const queryClassAPI = (params) => {
  return request({
    url: '/class/query',
    params
  })
}

/**
 * 添加班级
 * @param {Object} data: { name: 名称, description: 描述 }
 * @return Promise
 */
export const addClassAPI = (data) => {
  return request({
    url: '/class/',
    method: 'POST',
    data
  })
}

/**
 * 修改班级信息
 * @param {Object} data: { name: 名称, description: 描述 }
 * @return Promise
 */
export const updateClassAPI = (data) => {
  return request({
    url: '/class/',
    method: 'PATCH',
    data
  })
}

/**
 * 删除班级
 * @param id
 * @return Promise
 */
export const deleteClassAPI = (id) => {
  return request({
    url: `/class/${id}`,
    method: 'DELETE'
  })
}
